package com.firebird.app.fekpsl.ui.activity.sword.community

import android.widget.ImageView
import com.firebird.app.fekpsl.R
import com.firebird.app.fekpsl.adapter.sword.community.RoomListAdapter
import com.firebird.app.fekpsl.bean.Room
import com.firebird.app.fekpsl.ext.showToast
import kotlinx.android.synthetic.main.layout_toolbar.*
import kotlinx.android.synthetic.main.sword_community_room_list.*

class RoomListActivity : BaseActivity() {

    var roomAdapter: RoomListAdapter?=null

    override fun bindLayout(): Int {
        return R.layout.sword_community_room_list
    }

    override fun initData() {
        tv_title.text="房间列表"
        roomAdapter= RoomListAdapter(this, R.layout.sword_community_layout_room_list_item,null,object:RoomListAdapter.RoomItemClickListener{
            override fun OnItemClickListener(room: Room, image: ImageView, position: Int) {
                startActivity<ArenaActivity>("roomId" to 101)
            }
        })
        lv_room_list.adapter=roomAdapter

        var roomList:MutableList<Room>?=null
        var room:Room?=null;
        room!!.roomName="room1";
        //room!!.roomId=101
        roomList!!.add(room)
        room!!.roomName="room2";
        roomList!!.add(room)
        roomAdapter!!.upData(roomList)
    }

    override fun initEvent() {
        btn_random_matching.setOnClickListener {
            showToast("功能开发中，请稍后")
        }
    }

}